import { createApp } from 'vue'
import App from '@/App.vue'

const app = createApp(App)

// app.config.globalProperties.$url = import.meta.env.VITE_APP_BASE_API

// 全局样式
import "@/style/global.less";

// 引入注册脚本
// import 'virtual:svg-icons-register'
// 全局组件挂载
import SvgIcon from '@/components/SvgIcon.vue'
app.component('SvgIcon', SvgIcon)

import Loading from '@/components/Loading.vue'
app.component('Loading', Loading)


// 路由
import router from "@/router";
app.use(router)

import store from "@/store";
app.use(store)

// 工具函数
// import utils from "./utils";
// app.config.globalProperties.$utils = utils;

import mitt from 'mitt';
// app.config.globalProperties.$mitt = mitt();

// 数据请求
import axios from "@/axios";
import qs from 'qs';
// app.config.globalProperties.$axios = axios;
// app.config.globalProperties.$qs = qs;
// import { useRouter, useRoute } from 'vue-router'
import * as storage from "@/utils/storage";
app.provide('global', {
    // $router: useRouter(),
    // $route: useRoute(),
    $axios: axios,
    $store: store,
    $storage: storage,
    $qs: qs,
    $mitt: mitt(),
    $url: import.meta.env.VITE_APP_BASE_API
})

app.mount('#app')